<template>
  <div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableClass">
      <tr>
        <th colspan="4">订单基本信息</th>
      </tr>
      <tr>
        <td width="18%" nowrap="nowrap" class="title_item">{{$t('orderInfoManager.tradeIndex')}}:</td>
        <td>{{entity.tradeIndex}}</td>
        <td width="18%" nowrap="nowrap" class="title_item">{{$t('orderInfoManager.orderState')}}:</td>
        <td>
          <div
            v-for="item in orderStateList"
            :key="item.index"
            v-show="item.index == entity.orderState"
          >{{item.showName}}</div>
        </td>
      </tr>
      <tr>
        <td width="18%" nowrap="nowrap" class="title_item">{{$t('orderInfoManager.orderNum')}}:</td>
        <td>{{entity.orderNum}}</td>
        <td width="18%" nowrap="nowrap" class="title_item">{{$t('orderInfoManager.orderMoney')}}:</td>
        <td>{{entity.orderMoney}}</td>
      </tr>
      <tr>
        <td width="18%" nowrap="nowrap" class="title_item">{{$t('orderInfoManager.orderDateManager')}}:</td>
        <td colspan="3">
          {{$t('orderInfoManager.orderDate')}}:{{new Date(entity.addDate) | formatDate('yyyy-MM-dd hh:mm:ss')}}
          <br>
           <p v-if="entity.fahuoDate !=''&& entity.fahuoDate!=null">
              分红时间:{{new Date(entity.fahuoDate) | formatDate('yyyy-MM-dd hh:mm:ss')}}
              分红金额：{{entity.profitMoney}}
           </p>
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
import { getOrderDetail } from "@/api/manager/orderInfo";
import { formatDate } from "@/libs/tools";
export default {
  name: "orderDetail",
  props: {
    orderId: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      entity: {},
      orderStateList: []
    };
  },
  mounted: function() {},
  watch: {
    orderId: function(value) {
      if (value) {
        this.getData();
      }
    }
  },
  methods: {
    getData() {
      getOrderDetail(this.orderId)
        .then(response => {
          const data = response.data;
          this.entity = data.data.entity;
          this.orderStateList = data.data.orderStateList;
        })
        .catch(error => {});
    }
  }
};
</script>
